import axios from "axios";
import {CHANGEVALUE, ADDITEM, GETNAME, GETSAGA} from "./actionTypes"

export const addItem = () => ({
  type: ADDITEM,
})

export const changeValue = (e) => ({
  type: CHANGEVALUE,
  value: e.target.value,
})

export const getName = (param) => {
  return async dispatch => {
    const {data} = await axios.get(`https://api.muxiaoguo.cn/api/QqInfo?qq=${param}`)
    dispatch({
      type: GETNAME,
      name: data.data.name,
    })
  }
}

export const getSaga = () => ({
  type: GETSAGA
})